package com.mytijian.runtime.resolver;

import com.mytijian.runtime.model.param.AliCodeMerchantCommonParam;

import org.springframework.util.StringUtils;

import java.util.Map;

public class AliCodeMerchantRequestParamResolver extends AliRequestParamResolver<AliCodeMerchantCommonParam> {

	@Override
	public AliCodeMerchantCommonParam customResolver(Map<String, Object> reqParams) {
		AliCodeMerchantCommonParam param = new AliCodeMerchantCommonParam(reqParams);
		if (!StringUtils.isEmpty(reqParams.get("version"))) {
			param.setVersion(String.valueOf(reqParams.get("version")));
		}
		if (!StringUtils.isEmpty(reqParams.get("charset"))) {
			param.setCharset(String.valueOf(reqParams.get("charset")));
		}
		if (!StringUtils.isEmpty(reqParams.get("isPerfReq"))) {
			param.setIsPerfReq(String.valueOf(reqParams.get("isPerfReq")));
		}
		if (!StringUtils.isEmpty(reqParams.get("requestId"))) {
			param.setRequestId(String.valueOf(reqParams.get("requestId")));
		}
		if (!StringUtils.isEmpty(reqParams.get("outerId"))) {
			param.setOuterId(String.valueOf(reqParams.get("outerId")));
		}
		if (!StringUtils.isEmpty(reqParams.get("bizType"))) {
			param.setBizType(String.valueOf(reqParams.get("bizType")));
		}
		if (!StringUtils.isEmpty(reqParams.get("token"))) {
			param.setToken(String.valueOf(reqParams.get("token")));
		}
		if (!StringUtils.isEmpty(reqParams.get("organizerId"))) {
			param.setOrganizerId(String.valueOf(reqParams.get("organizerId")));
		}
		if (!StringUtils.isEmpty(reqParams.get("organizerNick"))) {
			param.setOrganizerNick(String.valueOf(reqParams.get("organizerNick")));
		}
		if (!StringUtils.isEmpty(reqParams.get("mobile"))) {
			param.setMobile(String.valueOf(reqParams.get("mobile")));
		}
		if (!StringUtils.isEmpty(reqParams.get("mobileType"))) {
			param.setMobileType(Integer.valueOf(String.valueOf(reqParams.get("mobileType"))));
		}
		if (!StringUtils.isEmpty(reqParams.get("idCard"))) {
			param.setIdCard(String.valueOf(reqParams.get("idCard")));
		}
		if (!StringUtils.isEmpty(reqParams.get("idCardType"))) {
			param.setIdCardType(Integer.valueOf(String.valueOf(reqParams.get("idCardType"))));
		}
		if (!StringUtils.isEmpty(reqParams.get("sendStyle"))) {
			param.setSendStyle(Integer.valueOf(String.valueOf(reqParams.get("sendStyle"))));
		}
		if (!StringUtils.isEmpty(reqParams.get("smsTemplate)"))) {
			param.setSmsTemplate(String.valueOf(reqParams.get("smsTemplate)")));
		}
		if (!StringUtils.isEmpty(reqParams.get("validStart"))) {
			param.setValidStart(String.valueOf(reqParams.get("validStart")));
		}
		if (!StringUtils.isEmpty(reqParams.get("validEnd"))) {
			param.setValidEnd(String.valueOf(reqParams.get("validEnd")));
		}
		if (!StringUtils.isEmpty(reqParams.get("amount"))) {
			param.setAmount(Integer.valueOf(String.valueOf(reqParams.get("amount"))));
		}
		if (!StringUtils.isEmpty(reqParams.get("availableNum"))) {
			param.setAvailableNum(Integer.valueOf(String.valueOf(reqParams.get("availableNum"))));
		}
		if (!StringUtils.isEmpty(reqParams.get("frequency)"))) {
			param.setFrequency(Integer.valueOf(String.valueOf(reqParams.get("frequency)"))));
		}
		if (!StringUtils.isEmpty(reqParams.get("itemId"))) {
			param.setItemId(String.valueOf(reqParams.get("itemId")));
		}
		if (!StringUtils.isEmpty(reqParams.get("itemTitle"))) {
			param.setItemTitle(String.valueOf(reqParams.get("itemTitle")));
		}
		if (!StringUtils.isEmpty(reqParams.get("outerIdP"))) {
			param.setOuterIdP(String.valueOf(reqParams.get("outerIdP")));
		}
		if (!StringUtils.isEmpty(reqParams.get("outerIdSKU"))) {
			param.setOuterIdSKU(String.valueOf(reqParams.get("outerIdSKU")));
		}
		if (!StringUtils.isEmpty(reqParams.get("totalFee"))) {
			param.setTotalFee(String.valueOf(reqParams.get("totalFee")));
		}
		if (!StringUtils.isEmpty(reqParams.get("mainOrderId"))) {
			param.setMainOrderId(String.valueOf(reqParams.get("mainOrderId")));
		}
		if (!StringUtils.isEmpty(reqParams.get("suitResult"))) {
			param.setSuitResult(String.valueOf(reqParams.get("suitResult")));
		}
		return param;
	}

}
